package com.qyer.search.model.mutable;

import com.qyer.search.model.aggregation.AggregationProduct;
import com.qyer.search.model.aggregation.ProductProject;
import com.qyer.search.model.result.SearchEntity;
import com.qyer.search.model.result.Type1SearchEntity;

import java.util.*;
/**
 * Created by tangzheng on 16/8/10.
 */
public class ProductSnapshot {

  //private Map<Integer, ProductProject> product_image;
  private IndexMap<ProductProject> product_image;
  private Map<Integer, Map<Integer, Set<Integer>>> stg_product;
  private Map<Integer, Map<Integer, Set<String>>> stg_product_str;
  private Map<Integer,Set<Integer>> st_product;
  private Map<Integer,Set<String>> st_product_str;
  private Map<Integer, String> tagInfo;
  private Map<Integer, String> poiInfo;
  ///++++++++++++++++++++++++++
  private Map<Integer, Map<Integer, AggregationProduct>> stg_census;
  private Map<Integer, Map<Integer, List<Type1SearchEntity>>> stg_entity;
  private Map<Integer, Set<String>> city_product;
  private Map<Integer, Set<String>> country_product;
  private Map<Integer, Set<String>> continent_product;
  private Map<Integer, Map<Integer, Map<Integer, List<SearchEntity>>>> stg_sort_entity;


  public ProductSnapshot(Map<Integer, ProductProject> product_image,
                         Map<Integer, Map<Integer, Set<Integer>>> stg_product,
                         Map<Integer, Set<Integer>> st_product, Map<Integer, String> tagInfo,
                         Map<Integer, String> poiInfo) {
    //this.product_image = product_image;
    this.stg_product = stg_product;
    this.st_product = st_product;
    this.tagInfo = tagInfo;
    this.poiInfo = poiInfo;
  }

  public ProductSnapshot() {
    //product_image = new HashMap<>(10000);
    product_image = new IndexMap<>(10);
    stg_product = new HashMap<>(40);
    st_product = new HashMap<>(40);

    stg_product_str = new HashMap<>(40);
    st_product_str = new HashMap<>(40);

    city_product = new HashMap<>();
    country_product = new HashMap<>();
    continent_product = new HashMap<>();
  }

  public Map<Integer, Map<Integer, Map<Integer, List<SearchEntity>>>> getStg_sort_entity() {
    return stg_sort_entity;
  }

  public void setStg_sort_entity(
    Map<Integer, Map<Integer, Map<Integer, List<SearchEntity>>>> stg_sort_entity) {
    this.stg_sort_entity = stg_sort_entity;
  }

  public Map<Integer, Set<String>> getContinent_product() {
    return continent_product;
  }

  public void setContinent_product(Map<Integer, Set<String>> continent_product) {
    this.continent_product = continent_product;
  }

  public Map<Integer, Set<String>> getCity_product() {
    return city_product;
  }

  public void setCity_product(Map<Integer, Set<String>> city_product) {
    this.city_product = city_product;
  }

  public Map<Integer, Set<String>> getCountry_product() {
    return country_product;
  }

  public void setCountry_product(Map<Integer, Set<String>> country_product) {
    this.country_product = country_product;
  }

  public Map<Integer, Map<Integer, List<Type1SearchEntity>>> getStg_entity() {
    return stg_entity;
  }

  public void setStg_entity(Map<Integer, Map<Integer, List<Type1SearchEntity>>> stg_entity) {
    this.stg_entity = stg_entity;
  }

  public Map<Integer, Map<Integer, AggregationProduct>> getStg_census() {
    return stg_census;
  }

  public ProductSnapshot setStg_census(Map<Integer, Map<Integer, AggregationProduct>> stg_census) {
    this.stg_census = stg_census;
    return this;
  }

  public Map<Integer, Map<Integer, Set<String>>> getStg_product_str() {
    return stg_product_str;
  }

  public void setStg_product_str(Map<Integer, Map<Integer, Set<String>>> stg_product_str) {
    this.stg_product_str = stg_product_str;
  }

  public Map<Integer, Set<String>> getSt_product_str() {
    return st_product_str;
  }

  public void setSt_product_str(Map<Integer, Set<String>> st_product_str) {
    this.st_product_str = st_product_str;
  }

  public Map<Integer, String> getPoiInfo() {
    return poiInfo;
  }

  public void setPoiInfo(Map<Integer, String> poiInfo) {
    this.poiInfo = poiInfo;
  }

  public Map<Integer, String> getTagInfo() {
    return tagInfo;
  }

  public void setTagInfo(Map<Integer, String> tagInfo) {
    this.tagInfo = tagInfo;
  }

  /*public Map<Integer, ProductProject> getProduct_image() {
    return product_image;
  }

  public void setProduct_image(Map<Integer, ProductProject> product_image) {
    this.product_image = product_image;
  }*/

  public IndexMap<ProductProject> getProduct_image() {
    return product_image;
  }

  public void setProduct_image(IndexMap<ProductProject> product_image) {
    this.product_image = product_image;
  }

  public Map<Integer, Map<Integer, Set<Integer>>> getStg_product() {
    return stg_product;
  }

  public void setStg_product(Map<Integer, Map<Integer, Set<Integer>>> stg_product) {
    this.stg_product = stg_product;
  }

  public Map<Integer, Set<Integer>> getSt_product() {
    return st_product;
  }

  public void setSt_product(Map<Integer, Set<Integer>> st_product) {
    this.st_product = st_product;
  }

  @Override public boolean equals(Object o) {
    if (this == o)
      return true;
    if (o == null || getClass() != o.getClass())
      return false;

    ProductSnapshot that = (ProductSnapshot) o;

    if (!product_image.equals(that.product_image))
      return false;
    if (!stg_product.equals(that.stg_product))
      return false;
    if (!st_product.equals(that.st_product))
      return false;
    if (!tagInfo.equals(that.tagInfo))
      return false;
    return poiInfo.equals(that.poiInfo);

  }

  @Override public int hashCode() {
    int result = product_image.hashCode();
    result = 31 * result + stg_product.hashCode();
    result = 31 * result + st_product.hashCode();
    result = 31 * result + tagInfo.hashCode();
    result = 31 * result + poiInfo.hashCode();
    return result;
  }

  @Override public String toString() {
    return "ProductSnapshot{" +
      "product_image=" + product_image +
      ", stg_product=" + stg_product +
      ", st_product=" + st_product +
      ", tagInfo=" + tagInfo +
      ", poiInfo=" + poiInfo +
      '}';
  }
}
